<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<script type="text/javascript" src="../../inc/ctx.jsp"></script>
<script type="text/javascript" src="../js/g.js"></script>
<script type="text/javascript" src="http://cdn.uuola.cn/js/formvalid.js" charset="utf-8"></script>
<link href="../css/com.css" type="text/css" rel="stylesheet"/>
<style>
    img.s1{width:100px;border:1px #EFEFEF solid;padding:1px;}
    #panel{width:90%;}
</style>
</head>
<body>

<div id="panel">
<form id="add_link_frm" name="add_link_frm">
  <table>
    <tr>
      <th colspan="5">编辑链接</th>
    </tr>
    <tr>
      <td width="10%" class="r">链接名称</td>
      <td width="26%">
        <input name="title" type="text" id="title" tabindex="1" maxlength="20" valid="required" errmsg="链接名称不能为空!" />* </td>
      <td width="13%">&nbsp;</td>
      <td width="22%" rowspan="3">
          <span class="img1"><img id="img_logopic" src="http://cdn.uuola.cn/img/vcode.jpg" width="100" class="hide"></span> </td>
      <td width="29%">上传链接图片</td>
    </tr>
    <tr>
      <td class="r">站点地址</td>
      <td>
      <textarea name="siteurl" type="text" id="siteurl" tabindex="2" valid="required|isUrl|limit" min="1" max="512" errmsg="站点地址不能为空!|链接地址错误!|字符数控制在512内" style="width:350px;height:100px;"></textarea>* </td>
      <td>&nbsp;</td>
      <td><input type="button" name="uploadBtn" id="uploadBtn" value="上传图片" tabindex="5" onclick="TxBox.upload('logopic', '', 'IMG.reset');"></td>
    </tr>
    <tr>
      <td class="r">链接类型</td>
      <td>
        <select name="lktype" id="lktype" tabindex="3">
        <script type="text/javascript" src="../js/linkcfg.js"></script>
      </select></td>
      <td>&nbsp;</td>
      <td><input type="hidden" name="logopic" id="logopic" value="-"/>
      <input type="hidden" name="lkid" id="lkid" value=""/></td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td><input name="submitBtn" type="button" class="button medium orange" id="submitBtn" tabindex="7" value="保存修改" onclick="LINK.submit();" /></td>
      <td>
      </td>
      <td>&nbsp;</td>
    </tr>
  </table>
 </form>
</div>

    
    
<script type="text/javascript">
   var LINK={
       lkid:'',
       init:function(){
           LINK.lkid = ut.get('lkid');
           $('#lkid').val(LINK.lkid);
$.get('../app/link/query_link.shtm?lkid='+LINK.lkid+'&t='+ut.r(),function(x){
    if(x.toString().indexOf('NULL')>0){
        ut.m(x);return;
    }else{
        $('#title').val(x.title);
        $('#siteurl').val(x.siteurl);
        $('#lktype').val(x.lktype);
        if(x.logopic.length>9){
            $('#logopic').val(x.logopic);
            IMG.reset('logopic', x.logopic);
        }
    }
}); 
           
       },
       submit:function(){
     var $rb=$('#submitBtn');
 if(validator(ut.e('add_link_frm'))){
     $rb.attr('disabled','disabled');
     $.post('../app/link/update.shtm',$('#add_link_frm').serialize(),function(x){
         var r = $.trim(x);
       if(r=='ok'){
           ut.m('添加成功!');
           win.close();
       }else{
           ut.m('添加链接失败!'+r);
           $rb.removeAttr('disabled');
       }
     });
 }   
       }
   };  
   LINK.init();
</script>
</body>
</html>
